package com.haha.webSocket.core.common;

import java.util.HashMap;
import java.util.Map;

/**
 * 机器人事件类型
 */
public class BotEventType {

    /**
     * GUILD_CREATE 当机器人加入新guild时
     */
    public static final String EVENT_GUILD_CREATE = "GUILD_CREATE";

    /**
     * GUILD_UPDATE 当guild资料发生变更时
     */
    public static final String EVENT_GUILD_UPDATE = "GUILD_UPDATE";

    /**
     * GUILD_DELETE 当机器人退出guild时
     */
    public static final String EVENT_GUILD_DELETE = "GUILD_DELETE";

    /**
     * CHANNEL_CREATE 当channel被创建时
     */
    public static final String EVENT_CHANNEL_CREATE = "CHANNEL_CREATE";

    /**
     * CHANNEL_UPDATE 当channel被更新时
     */
    public static final String EVENT_CHANNEL_UPDATE = "CHANNEL_UPDATE";

    /**
     * CHANNEL_DELETE 当channel被删除时
     */
    public static final String EVENT_CHANNEL_DELETE = "CHANNEL_DELETE";

    /**
     * GUILD_MEMBER_ADD 当成员加入时
     */
    public static final String EVENT_GUILD_MEMBER_ADD = "GUILD_MEMBER_ADD";

    /**
     * GUILD_MEMBER_UPDATE 当成员资料变更时
     */
    public static final String EVENT_GUILD_MEMBER_UPDATE = "GUILD_MEMBER_UPDATE";

    /**
     * GUILD_MEMBER_REMOVE 当成员被移除时
     */
    public static final String EVENT_GUILD_MEMBER_REMOVE = "GUILD_MEMBER_REMOVE";

    /**
     * MESSAGE_CREATE  发送消息事件，代表频道内的全部消息，而不只是 at 机器人的消息。内容与 AT_MESSAGE_CREATE 相同
     */
    public static final String EVENT_MESSAGE_CREATE = "MESSAGE_CREATE";

    /**
     * MESSAGE_DELETE 删除（撤回）消息事件
     */
    public static final String EVENT_MESSAGE_DELETE = "MESSAGE_DELETE";

    /**
     * MESSAGE_REACTION_ADD  为消息添加表情表态
     */
    public static final String EVENT_MESSAGE_REACTION_ADD = "MESSAGE_REACTION_ADD";

    /**
     * MESSAGE_REACTION_REMOVE  为消息删除表情表态
     */
    public static final String EVENT_MESSAGE_REACTION_REMOVE = "MESSAGE_REACTION_REMOVE";

    /**
     * AT_MESSAGE_CREATE 当收到@机器人的消息时
     */
    public static final String EVENT_AT_MESSAGE_CREATE = "AT_MESSAGE_CREATE";

    /**
     * PUBLIC_MESSAGE_DELETE 当频道的消息被删除时
     */
    public static final String EVENT_PUBLIC_MESSAGE_DELETE = "PUBLIC_MESSAGE_DELETE";

    /**
     * DIRECT_MESSAGE_CREATE  当收到用户发给机器人的私信消息时
     */
    public static final String EVENT_DIRECT_MESSAGE_CREATE = "DIRECT_MESSAGE_CREATE";

    /**
     * DIRECT_MESSAGE_DELETE  删除（撤回）消息事件
     */
    public static final String EVENT_DIRECT_MESSAGE_DELETE = "DIRECT_MESSAGE_DELETE";


    /**
     * AUDIO_START 音频开始播放时
     */
    public static final String EVENT_AUDIO_START = "AUDIO_START";

    /**
     * AUDIO_FINISH 音频播放结束时
     */
    public static final String EVENT_AUDIO_FINISH = "AUDIO_FINISH";

    /**
     * AUDIO_ON_MIC 上麦时
     */
    public static final String EVENT_AUDIO_ON_MIC = "AUDIO_ON_MIC";

    /**
     * AUDIO_OFF_MIC 下麦时
     */
    public static final String EVENT_AUDIO_OFF_MIC = "AUDIO_OFF_MIC";

    /**
     * MESSAGE_AUDIT_PASS 消息审核通过
     */
    public static final String EVENT_MESSAGE_AUDIT_PASS = "MESSAGE_AUDIT_PASS";

    /**
     * MESSAGE_AUDIT_REJECT 消息审核不通过
     */
    public static final String EVENT_MESSAGE_AUDIT_REJECT = "MESSAGE_AUDIT_REJECT";

    /**
     * FORUM_THREAD_CREATE 当用户创建主题时
     */
    public static final String EVENT_FORUM_THREAD_CREATE = "FORUM_THREAD_CREATE";

    /**
     * FORUM_THREAD_UPDATE 当用户更新主题时
     */
    public static final String EVENT_FORUM_THREAD_UPDATE = "FORUM_THREAD_UPDATE";

    /**
     * FORUM_THREAD_DELETE 当用户删除主题时
     */
    public static final String EVENT_FORUM_THREAD_DELETE = "FORUM_THREAD_DELETE";

    /**
     * FORUM_POST_CREATE 当用户创建帖子时
     */
    public static final String EVENT_FORUM_POST_CREATE = "FORUM_POST_CREATE";

    /**
     * FORUM_POST_DELETE 当用户删除帖子时
     */
    public static final String EVENT_FORUM_POST_DELETE = "FORUM_POST_DELETE";

    /**
     * FORUM_REPLY_CREATE 当用户回复评论时
     */
    public static final String EVENT_FORUM_REPLY_CREATE = "FORUM_REPLY_CREATE";

    /**
     * FORUM_REPLY_DELETE 当用户删除评论时
     */
    public static final String EVENT_FORUM_REPLY_DELETE = "FORUM_REPLY_DELETE";

    /**
     * FORUM_PUBLISH_AUDIT_RESULT 当用户发表审核通过时
     */
    public static final String EVENT_FORUM_PUBLISH_AUDIT_RESULT = "FORUM_PUBLISH_AUDIT_RESULT";

    /**
     * INTERACTION_CREATE 互动事件
     */
    public static final String EVENT_INTERACTION_CREATE = "INTERACTION_CREATE";

    /**
     * AUDIO_OR_LIVE_CHANNEL_MEMBER_ENTER 当用户进入音视频/直播子频道
     */
    public static final String EVENT_AUDIO_OR_LIVE_CHANNEL_MEMBER_ENTER = "AUDIO_OR_LIVE_CHANNEL_MEMBER_ENTER";

    /**
     * AUDIO_OR_LIVE_CHANNEL_MEMBER_EXIT 当用户离开音视频/直播子频道
     */
    public static final String EVENT_AUDIO_OR_LIVE_CHANNEL_MEMBER_EXIT = "AUDIO_OR_LIVE_CHANNEL_MEMBER_EXIT";

    /**
     * GROUP_AT_MESSAGE_CREATE 当收到群@机器人的消息时
     */
    public static final String EVENT_GROUP_AT_MESSAGE_CREATE = "GROUP_AT_MESSAGE_CREATE";

    /**
     * C2C_MESSAGE_CREATE 当收到C2C的消息时
     */
    public static final String EVENT_C2C_MESSAGE_CREATE = "C2C_MESSAGE_CREATE";

    /**
     * GROUP_ADD_ROBOT 机器人加入群聊
     */
    public static final String EVENT_GROUP_ADD_ROBOT = "GROUP_ADD_ROBOT";

    /**
     * GROUP_DEL_ROBOT 机器人退出群聊
     */
    public static final String EVENT_GROUP_DEL_ROBOT = "GROUP_DEL_ROBOT";

    /**
     * GROUP_MSG_REJECT 群聊拒绝机器人主动消息
     */
    public static final String EVENT_GROUP_MSG_REJECT = "GROUP_MSG_REJECT";

    /**
     * GROUP_MSG_RECEIVE 群聊接受机器人主动消息
     */
    public static final String EVENT_GROUP_MSG_RECEIVE = "GROUP_MSG_RECEIVE";

    /**
     * FRIEND_ADD 用户添加机器人
     */
    public static final String EVENT_FRIEND_ADD = "FRIEND_ADD";

    /**
     * FRIEND_DEL 用户删除机器人
     */
    public static final String EVENT_FRIEND_DEL = "FRIEND_DEL";

    /**
     * C2C_MSG_REJECT 用户拒绝机器人主动消息
     */
    public static final String EVENT_C2C_MSG_REJECT = "C2C_MSG_REJECT";

    /**
     * C2C_MSG_RECEIVE 用户接受机器人主动消息
     */
    public static final String EVENT_C2C_MSG_RECEIVE = "C2C_MSG_RECEIVE";

    /**
     * OPEN_FORUM_THREAD_CREATE 当用户创建主题时
     */
    public static final String EVENT_OPEN_FORUM_THREAD_CREATE = "OPEN_FORUM_THREAD_CREATE";

    /**
     * OPEN_FORUM_THREAD_UPDATE 当用户更新主题时
     */
    public static final String EVENT_OPEN_FORUM_THREAD_UPDATE = "OPEN_FORUM_THREAD_UPDATE";

    /**
     * OPEN_FORUM_THREAD_DELETE 当用户删除主题时
     */
    public static final String EVENT_OPEN_FORUM_THREAD_DELETE = "OPEN_FORUM_THREAD_DELETE";

    /**
     * OPEN_FORUM_POST_CREATE 当用户创建帖子时
     */
    public static final String EVENT_OPEN_FORUM_POST_CREATE = "OPEN_FORUM_POST_CREATE";

    /**
     * OPEN_FORUM_POST_DELETE 当用户删除帖子时
     */
    public static final String EVENT_OPEN_FORUM_POST_DELETE = "OPEN_FORUM_POST_DELETE";

    /**
     * OPEN_FORUM_REPLY_CREATE 当用户回复评论时
     */
    public static final String EVENT_OPEN_FORUM_REPLY_CREATE = "OPEN_FORUM_REPLY_CREATE";

    /**
     * OPEN_FORUM_REPLY_DELETE 当用户删除评论时
     */
    public static final String EVENT_OPEN_FORUM_REPLY_DELETE = "OPEN_FORUM_REPLY_DELETE";


    /**
     * 机器人事件类型
     */
    public static final String[] EVENT_TYPES = {
            EVENT_GUILD_CREATE,
            EVENT_GUILD_UPDATE,
            EVENT_GUILD_DELETE,
            EVENT_CHANNEL_CREATE,
            EVENT_CHANNEL_UPDATE,
            EVENT_CHANNEL_DELETE,
            EVENT_GUILD_MEMBER_ADD,
            EVENT_GUILD_MEMBER_UPDATE,
            EVENT_GUILD_MEMBER_REMOVE,
            EVENT_MESSAGE_CREATE,
            EVENT_MESSAGE_DELETE,
            EVENT_MESSAGE_REACTION_ADD,
            EVENT_MESSAGE_REACTION_REMOVE,
            EVENT_AT_MESSAGE_CREATE,
            EVENT_PUBLIC_MESSAGE_DELETE,
            EVENT_DIRECT_MESSAGE_CREATE,
            EVENT_DIRECT_MESSAGE_DELETE,
            EVENT_AUDIO_START,
            EVENT_AUDIO_FINISH,
            EVENT_AUDIO_ON_MIC,
            EVENT_AUDIO_OFF_MIC,
            EVENT_MESSAGE_AUDIT_PASS,
            EVENT_MESSAGE_AUDIT_REJECT,
            EVENT_FORUM_THREAD_CREATE,
            EVENT_FORUM_THREAD_UPDATE,
            EVENT_FORUM_THREAD_DELETE,
            EVENT_FORUM_POST_CREATE,
            EVENT_FORUM_POST_DELETE,
            EVENT_FORUM_REPLY_CREATE,
            EVENT_FORUM_REPLY_DELETE,
            EVENT_FORUM_PUBLISH_AUDIT_RESULT,
            EVENT_INTERACTION_CREATE,
            EVENT_AUDIO_OR_LIVE_CHANNEL_MEMBER_ENTER,
            EVENT_AUDIO_OR_LIVE_CHANNEL_MEMBER_EXIT,
            EVENT_GROUP_AT_MESSAGE_CREATE,
            EVENT_C2C_MESSAGE_CREATE,
            EVENT_GROUP_ADD_ROBOT,
            EVENT_GROUP_DEL_ROBOT,
            EVENT_GROUP_MSG_REJECT,
            EVENT_GROUP_MSG_RECEIVE,
            EVENT_FRIEND_ADD,
            EVENT_FRIEND_DEL,
            EVENT_C2C_MSG_REJECT,
            EVENT_C2C_MSG_RECEIVE,
            EVENT_OPEN_FORUM_THREAD_CREATE,
            EVENT_OPEN_FORUM_THREAD_UPDATE,
            EVENT_OPEN_FORUM_THREAD_DELETE,
            EVENT_OPEN_FORUM_POST_CREATE,
            EVENT_OPEN_FORUM_POST_DELETE,
            EVENT_OPEN_FORUM_REPLY_CREATE,
            EVENT_OPEN_FORUM_REPLY_DELETE
    };

    public static Map<Integer, String[]> botIntentEventMap = new HashMap<>();

    /**
     * 机器人事件类型与机器人意图的映射关系
     */
    static {
        botIntentEventMap.put(BotIntent.IntentGuilds, new String[]{
                BotEventType.EVENT_GUILD_CREATE,
                BotEventType.EVENT_GUILD_UPDATE,
                BotEventType.EVENT_GUILD_DELETE,
                BotEventType.EVENT_CHANNEL_CREATE,
                BotEventType.EVENT_CHANNEL_UPDATE,
                BotEventType.EVENT_CHANNEL_DELETE,
                BotEventType.EVENT_GUILD_MEMBER_ADD
        });

        botIntentEventMap.put(BotIntent.IntentGuildMembers, new String[]{
                BotEventType.EVENT_GUILD_MEMBER_ADD,
                BotEventType.EVENT_GUILD_MEMBER_UPDATE,
                BotEventType.EVENT_GUILD_MEMBER_REMOVE
        });

        botIntentEventMap.put(BotIntent.IntentGuildMessages, new String[]{
                BotEventType.EVENT_MESSAGE_CREATE,
                BotEventType.EVENT_MESSAGE_DELETE
        });

        botIntentEventMap.put(BotIntent.IntentGuildMessageReactions, new String[]{
                BotEventType.EVENT_MESSAGE_REACTION_ADD,
                BotEventType.EVENT_MESSAGE_REACTION_REMOVE
        });

        botIntentEventMap.put(BotIntent.IntentDirectMessages, new String[]{
                BotEventType.EVENT_DIRECT_MESSAGE_CREATE,
                BotEventType.EVENT_DIRECT_MESSAGE_DELETE
        });

        botIntentEventMap.put(BotIntent.IntentOpenForumsEvent, new String[]{
                BotEventType.EVENT_OPEN_FORUM_THREAD_CREATE,
                BotEventType.EVENT_OPEN_FORUM_THREAD_UPDATE,
                BotEventType.EVENT_OPEN_FORUM_THREAD_DELETE,
                BotEventType.EVENT_OPEN_FORUM_POST_CREATE,
                BotEventType.EVENT_OPEN_FORUM_POST_DELETE,
                BotEventType.EVENT_OPEN_FORUM_REPLY_CREATE,
                BotEventType.EVENT_OPEN_FORUM_REPLY_DELETE
        });

        botIntentEventMap.put(BotIntent.IntentAuditOrLiveChannelMember, new String[]{
                BotEventType.EVENT_AUDIO_OR_LIVE_CHANNEL_MEMBER_ENTER,
                BotEventType.EVENT_AUDIO_OR_LIVE_CHANNEL_MEMBER_EXIT
        });

        botIntentEventMap.put(BotIntent.IntentPublicMessage, new String[]{
                BotEventType.EVENT_GROUP_AT_MESSAGE_CREATE,
                BotEventType.EVENT_C2C_MESSAGE_CREATE,
                BotEventType.EVENT_GROUP_ADD_ROBOT,
                BotEventType.EVENT_GROUP_DEL_ROBOT,
                BotEventType.EVENT_GROUP_MSG_REJECT,
                BotEventType.EVENT_GROUP_MSG_RECEIVE,
                BotEventType.EVENT_FRIEND_ADD,
                BotEventType.EVENT_FRIEND_DEL,
                BotEventType.EVENT_C2C_MSG_REJECT,
                BotEventType.EVENT_C2C_MSG_RECEIVE
        });

        botIntentEventMap.put(BotIntent.IntentInteraction, new String[]{
                BotEventType.EVENT_INTERACTION_CREATE
        });


        botIntentEventMap.put(BotIntent.IntentAudit, new String[]{
                BotEventType.EVENT_MESSAGE_AUDIT_PASS,
                BotEventType.EVENT_MESSAGE_AUDIT_REJECT
        });

        botIntentEventMap.put(BotIntent.IntentForum, new String[]{
                BotEventType.EVENT_FORUM_THREAD_CREATE,
                BotEventType.EVENT_FORUM_THREAD_UPDATE,
                BotEventType.EVENT_FORUM_THREAD_DELETE,
                BotEventType.EVENT_FORUM_POST_CREATE,
                BotEventType.EVENT_FORUM_POST_DELETE,
                BotEventType.EVENT_FORUM_REPLY_CREATE,
                BotEventType.EVENT_FORUM_REPLY_DELETE,
                BotEventType.EVENT_FORUM_PUBLISH_AUDIT_RESULT
        });

        botIntentEventMap.put(BotIntent.IntentAudio, new String[]{
                BotEventType.EVENT_AUDIO_START,
                BotEventType.EVENT_AUDIO_FINISH,
                BotEventType.EVENT_AUDIO_ON_MIC,
                BotEventType.EVENT_AUDIO_OFF_MIC
        });

        botIntentEventMap.put(BotIntent.IntentPublicGuildMessage, new String[]{
                BotEventType.EVENT_AT_MESSAGE_CREATE,
                BotEventType.EVENT_PUBLIC_MESSAGE_DELETE
        });

    }

}
